﻿using System;
using System.Collections.Generic;
using System.Drawing;

namespace AiFrame.InterfaceLib.MVP
{
    /// <summary>
    /// Represents a window manager for controllable data windows.
    /// </summary>
    /// <typeparam name="T">Type of the window to display.</typeparam>
    public interface IControllableDataWindowManager<T>: IWindowManager<T>
    {
        /// <summary>
        /// Registers a new window.
        /// </summary>
        /// <param name="buttonName">Name of the button.</param>
        /// <param name="buttonCaption">Caption of the button.</param>
        /// <param name="normalImage">The image.</param>
        /// <param name="hoveredImage">The hovered image.</param>
        /// <param name="window">The window.</param>
        void RegisterWindow(string buttonName, string buttonCaption, Image normalImage,
                            Image hoveredImage, T window);
        
        /// <summary>
        /// Recalls the save methods in all data windows.
        /// </summary>
        void SaveDataWindows();

        /// <summary>
        /// Gets raised when a new window is registered.
        /// </summary>
        event EventHandler<WindowRegisteredEventArgs<T>> WindowRegistered;

        /// <summary>
        /// Returns all registered windows.
        /// </summary>
        /// <returns></returns>
        IList<T> GetWindows();
    }

    /// <summary>
    /// The events arguments for the window registered event.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class WindowRegisteredEventArgs<T>: EventArgs
    {
        public WindowRegisteredEventArgs(T window)
        {
            this.Window = window;
        }

        public T Window { get; set; }
    }
}
